<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
		<script type="text/javascript" src='../../../JS/SHA-1.js'></script>
		<script type="text/javascript" src='../../../JS/detailView.js'></script>
	</head>

	<body style="padding: 0px;">

		<div class="easyui-layout" style="width:100%;height:600px;">
			<div data-options="region:'center'">
				<div>
					<table id="dg" style="width:100%;height:250px" fitColumns="true">
					</table>
				</div>
			</div>
		</div>
		<div id="toolbar"></div>
	</body>
	<script type="text/javascript">
		var content; //保存明细按钮
		content = AddToolBar(43);
		$('#toolbar').append(content);
		$('#dg').datagrid({
			url: RemoteLinkAddress + '/logistics/warehouseout/list.do',
			toolbar: '#toolbar',
			method: 'get',
			pagination: 'true',
			rownumbers: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			height: 350,
			columns: [
				[{
					field: 'ck',
					checkbox: 'true',
				}, {
					field: 'ID',
					title: '编号',
					width: '5%',
					align: 'center'
				}, {
					field: 'ORDER_NO',
					title: '出库单编号',
					width: '10%',
					align: 'center'
				}, {
					field: 'CUSTOMER_TYPE',
					title: '用户组',
					width: '15%',
					align: 'center'
				}, {
					field: 'CUSTOMER_NAME',
					title: '配送单位',
					width: '15%',
					align: 'center'
				}, {
					field: 'DISTRIBUTION_DATE',
					title: '配送时间',
					width: '10%',
					align: 'center'
				}, {
					field: 'CREATE_TIME',
					title: '建单时间',
					width: '10%',
					align: 'center'
				}, {
					field: 'ISVERIFY',
					title: '审核状态',
					width: '8%',
					align: 'center',
					formatter: function(value, row, index) {
						return verifyStatus(value, false);
					}
				}, {
					field: 'STATE',
					title: '订单状态',
					width: '8%',
					align: 'center'
				}, {
					field: 'LUMP_SUM',
					title: '总价',
					width: '8%',
					align: 'center'
				}]
			],
			onDblClickRow: function(index, row) {
				toAddForEdit();
			}
		})

		function newdata() {
			var pLocation = "";
			pLocation = "UI/LOGISTICS/WareHouseOutCreate/WareHouseOutSearch.html";
			AddTabIn("查询未出库单", parent.parent.$("#tabs"), pLocation);
		}

		function editdata() {
			toAddForEdit();
		}

		function redodata() {
			var _url = RemoteLinkAddress + '/logistics/warehouseout/list.do';
			$.ajax({
				dataType: "json",
				type: "get",
				url: _url,
				success: function(result) {
					if(result != null) {
						var _data = result;
						$('#dg').datagrid('loadData', _data);
					}
				},
				error: function(xhr, status, error) {
					$.messager.alert("错误", "请求失败!");
				}
			});
		}

		function toAddForEdit() {
			var row = $("#dg").datagrid("getSelected");
			if(!row) {
				$.messager.alert("警告", "请选中数据");
			} else {
				var pLocation = "";
				pLocation = "UI/LOGISTICS/WareHouseOutOrder/WareHouseOutOrderAdd.html?ID=" + row.ID;
				AddTabIn("修改出库单", parent.parent.$("#tabs"), pLocation);
			}
		}

		function print() {
			var row = $('#dg').datagrid('getSelections');
			if(row.length == 0) {
				$.messager.alert('Info', "没有选中");
				return;
			}
			var selectedID = "";
			for(var i = 0; i < row.length; i++) {
				selectedID = selectedID + row[i].ID + ";";
			}
			var pLocation = "WareHouseOutOrderPrint.html?id=" + selectedID;
			window.open(pLocation); 
		}
	</script>

</html>